<template>
	<view class="content" style="background-color: #857fd8;padding: 20rpx; margin: 20rpx;">
		<view class="title">子组件B</view>
		<view class="b-box">
			CompA组件传进来的值：
			<text class="intent-text-box" style="background-color: #fff; padding: 5rpx;">{{result}}</text>
		</view>
		<view class="b-box" style="margin: 10rpx;">
			<text>回传值：</text>
			<input type="text" v-model="callbackValue" style="color: yellow;border: 1px solid #ccc; padding:5rpx;"></input>
			<button @click="sendOutside()" size="mini">回传</button>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				result:'',
				callBackValue:''
			}
		},
		created() {
			uni.$on('getIntent',(val) => {
				this.result = val
			})
		},
		methods: {
			sendOutside(){
				console.warn('当输入框的值:',this.callBackValue);
				console.warn('----ComB----sendOutside---->' + this.callBackValue)
				this.$emit('callBackFun',this.callBackValue)
			}
		}
	}
</script>

<style>
.title{
	font-size: 30rpx;
	font-weight: bold;
	margin-bottom: 20rpx;
}
.b-box{
	margin: 10rpx 0;
}
</style>
